package objects
{
	/**
	 * @author rob.thurston
	 */
	public class Laser extends AbstractObject
	{
		[Embed(source="../assets/assets.swf", symbol="Laser")]
		protected var LaserClass : Class;
		
		private var _size : Number;
		private var _isHorizontal : Boolean;
		private var _onDuration : Number;
		private var _offDuration : Number;

		public function Laser(yOffset : Number)
		{
			super(yOffset);

			_asset = new LaserClass();
			addChild(_asset);
		}
		
		public function set size(laserSize : Number) : void
		{
			_size = laserSize;
			_asset.rotation = 0;
			_asset.width = laserSize;
		}
		
		public function set horizontal(isHorizontal : Boolean) : void
		{
			_isHorizontal = isHorizontal;
			_asset.rotation = (isHorizontal) ? 0 : 90;
		}
		
		override public function getCode() : String
		{
			var code : String = "";
			
			code = "[self addLaser:ccp(" + x + "," + (_yOffset - y) + ") size:" + _size + " horizontal:" + _isHorizontal + " onDuration:"+ _onDuration +".0f offDuration:"+ _offDuration +".0f  startDelay:0.0f]";
			
			return code;
		}

		public function set onDuration(onDuration : Number) : void
		{
			_onDuration = onDuration;
		}

		public function set offDuration(offDuration : Number) : void
		{
			_offDuration = offDuration;
		}
	}
}
